//
//  ImageStretchingViewController.m
//  20170207
//
//  Created by xuPeng on 2017/9/7.
//  Copyright © 2017年 一直丶黑曼巴. All rights reserved.
//
#import "Header.h"
#import "ImageStretchingViewController.h"

@interface ImageStretchingViewController ()

@end

@implementation ImageStretchingViewController

- (void)viewDidLoad {
    
    /*
        这个没搞懂，图片本身就是填满UIImageView
     */
    [super viewDidLoad];
    
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake((PW - 100)/2, 100, 200, 200)];
    imageView.backgroundColor = [UIColor cyanColor];
    UIImage *img = [UIImage imageNamed:@"13.jpg"];
    UIEdgeInsets edge = UIEdgeInsetsMake(0, 10, 0, 10);
    
    //UIImageResizingModeStretch：拉伸模式，通过拉伸UIEdgeInsets指定的矩形区域来填充图片
    //UIImageResizingModeTile：平铺模式，通过重复显示UIEdgeInsets指定的矩形区域来填充图
    img = [img resizableImageWithCapInsets:edge resizingMode:UIImageResizingModeStretch];
    imageView.image = img;
    [self.view addSubview:imageView];
}



@end
